package org.wxl.liangpicturebackend.common;

import lombok.Data;
import org.wxl.liangpicturebackend.exception.ErrorCode;

@Data
public class BaseResponse<T> {
    private int code;
    /**
     * 返回信息
     * 使用泛型，可以返回任何类型
     */
    private T Data;

    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.Data = data;
        this.message = message;
    }
    public BaseResponse(int code, T data) {
        this(code, data, "");
    }
    public BaseResponse(int code, String message) {
        this(code, null, message);
    }
    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), errorCode.getMessage());
    }
}
